package com.dwy2002.appointment.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 分页拦截器
 *
 * @author 杜伟毅
 * @version 1.0
 * @since 2025/01/21
 */
@Configuration
public class MyPageConfig {
    //新的分页插件，一缓和二缓遵循mybatis的规则,需要设 MybatisConfiguration#useDeprecatedExecutor = fals
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
